package com.stox.ui.javafx.core.animation;

import javafx.animation.FadeTransition;
import javafx.animation.Transition;
import javafx.scene.Node;
import javafx.util.Duration;


public class Transitions{
	
	private static double duration = 0.3;
	
	private static Transition getTransition(Node node, double duration, double fromX, double fromY, double toX, double toY) {
		FadeTransition fadeTransition = new FadeTransition();
		fadeTransition.setDuration(Duration.seconds(duration));
		fadeTransition.setNode(node);
		fadeTransition.setFromValue(fromX);
		fadeTransition.setToValue(toX);
		return fadeTransition;
	}
	
	public static Transition getClose(Node node) {
		return getTransition(node, duration, 1, 1, 0, 0);
	}
	
	
	public static Transition getMinimize(Node node) {
		return getTransition(node, duration, 1, 1, 0, 0);
	}
	
	public static Transition getOpen(Node node) {
		return getTransition(node, duration, 0, 0, 1, 1);
	}
	
	public static Transition getRestore(Node node) {
		return getTransition(node, duration, 0, 0, 1, 1);
	}
}
